{include file='common/head'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>商户列表</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="{:url('admin/shop/index')}" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>

</div>


    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
            <button type="button" class="layui-btn" onclick="x_admin_show('添加商户','{:url(\'admin/shop/insert\')}')"><i class="layui-icon"></i>添加商户</button>
        </form>
    </div>
    <form class="layui-form" action="" method="post">
    <table class="layui-table">
        <thead>
        <tr style="text-align: center">
            <th style="text-align: center">NO</th>
            <th style="text-align: center">商户账号</th>
            <th style="text-align: center">商户名</th>
            <th style="text-align: center">手机号</th>
            <th style="text-align: center">商户密钥</th>
            <th style="text-align: center">创建时间</th>
            <th style="text-align: center">状态</th>
            <th style="text-align: center">余额</th>
            <th style="text-align: center">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name='user' id='user' key='key'}
        <tr style="text-align: center">
            <td>{$key}</td>
            <td>{$user.shopid}</td>
            <td>{$user.username}</td>
            <td>{$user.phone}</td>
            <td>{$user.appkey}</td>
            <td>{$user.createtime}</td>
            <td>{if $user.status==1}正常{else/}锁定{/if}</td>
            <td>{$user.money}</td>
            <td><input type="checkbox" <?php if ($user['status'] ==0): ?>  checked="" <?php endif; ?> name="status[]" lay-skin="switch" lay-filter="Suodoing" lay-text="锁定|解锁" value="{$user.shopid}"></td>
        </tr>
        {/volist}
        </tbody>
    </table>
    </form>
    <div class="page">
        <div>
            {$page}
        </div>
    </div>

</div>
<script>
    layui.use(['laydate','form'], function() {
        var laydate = layui.laydate;
        var form = layui.form;
        form.on('switch(Suodoing)', function (data) {
            var shopid = data.value;
            // alert(shopid);
            //监听提交
            $.ajax({
                url: "{:url('admin/shop/suoding')}",
                type: "post",
                dataType: "JSON",
                data: {shopid: shopid},
                success: function (res) {
                    if (res == 1) {
                        layer.msg('操作成功！');
                        return false;
                    } else {
                        layer.msg('操作失败！');
                        return false;
                    }
                }
            });
        });
    })
</script>

</body>

</html>